package com.xuan.controller.pg;

import com.xuan.configuration.result.ResponseResult;
import com.xuan.configuration.result.ResponseResultEnum;
import com.xuan.dto.pg.bazi.*;
import com.xuan.service.pg.PgBaZiService;
import com.xuan.vo.pg.bazi.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 八字排盘Controller
 */
@RestController
@RequestMapping("/pgBaZi")
public class PgBaZiController {

    @Autowired
    private PgBaZiService pgBaZiService; // 八字排盘Service

//********************************************************************************************************************************

    /**
     * 开始排盘
     *
     * @param dto 八字排盘数据接收类
     * @return 排盘数据
     */
    @PostMapping("/starts")
    public ResponseResult<PgBaZiVo> starts(@RequestBody PgBaZiDto dto) {

        PgBaZiVo vo = pgBaZiService.starts(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "排盘成功", vo);

    }

    /**
     * 初始化大运流年
     *
     * @param dto 大运流年初始化请求数据
     * @return 大运基本数据、流年基本数据、小运基本数据、流月基本数据、大运流年命盘数据、大运流年与其他干支的干支留意数据
     */
    @PostMapping("/daYunLiuNianInitialize")
    public ResponseResult<PgBaZiDaYunLiuNianInitializeVo> daYunLiuNianInitialize(@RequestBody PgBaZiDaYunLiuNianInitializeDto dto) {

        PgBaZiDaYunLiuNianInitializeVo vo = pgBaZiService.daYunLiuNianInitialize(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "初始化成功", vo);

    }

    /**
     * 大运切换
     *
     * @param dto 大运切换请求数据
     * @return 流年基本数据、小运基本数据、流月基本数据、大运流年命盘数据、大运流年与其他干支的干支留意数据
     */
    @PostMapping("/daYun")
    public ResponseResult<PgBaZiDaYunVo> daYun(@RequestBody PgBaZiDaYunDto dto) {

        PgBaZiDaYunVo vo = pgBaZiService.daYun(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "切换成功", vo);

    }

    /**
     * 流年\小运切换
     *
     * @param dto 流年\小运切换请求数据
     * @return 流月基本数据、流年命盘数据、流年与其他干支的干支留意数据
     */
    @PostMapping("/liuNian")
    public ResponseResult<PgBaZiLiuNianVo> liuNian(@RequestBody PgBaZiLiuNianDto dto) {

        PgBaZiLiuNianVo vo = pgBaZiService.liuNian(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "切换成功", vo);

    }

    /**
     * 流月切换
     *
     * @param dto 流月切换请求数据
     * @return 流日基本数据、流月命盘数据、流月与其他干支的干支留意数据
     */
    @PostMapping("/liuYue")
    public ResponseResult<PgBaZiLiuYueVo> liuYue(@RequestBody PgBaZiLiuYueDto dto) {

        PgBaZiLiuYueVo vo = pgBaZiService.liuYue(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "切换成功", vo);

    }

    /**
     * 胎命身切换
     *
     * @param dto 胎命身切换请求数据
     * @return 胎命身数据
     */
    @PostMapping("/taiMingShen")
    public ResponseResult<PgBaZiTaiMingShenVo> taiMingShen(@RequestBody PgBaZiTaiMingShenDto dto) {

        PgBaZiTaiMingShenVo vo = pgBaZiService.taiMingShen(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, "切换成功", vo);

    }


}
